
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>跟进历史管理</title>
    <#include "../common/link.ftl" >
   <script type="text/javascript">
       $(function () {
           $(".inputBtn").on("click",function () {
                var json = $(this).data("json");
               console.log(json);
               if(json){
                    $("input[name=id]").val(json.id);
                    $("input[name='customer.name']").val(json.customer);
                    $("input[name=traceTime]").val(json.traceTime);
                    $("input[name=traceDetails]").val(json.traceDetails);
                    $("select[name='traceType.id']").val(json.traceType);
                    $("select[name=traceResult]").val(json.traceResult);
                    $("input[name=remark]").val(json.remark);
                    $("select[name=type]").val(json.type);
                }
               $("#editModal").modal("show");
           })
           $(".inputSubmit").on("click",function () {
               $("#editForm").ajaxSubmit(function (data) {
                   if(data.success){
                       $.messager.alert("温馨提示","两秒后自动刷新");
                       window.setTimeout(function () {
                           window.location.reload();
                       },2000)
                   }else{
                       alert(data.msg);
                   }
               })
           })
       })
   </script>


</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl" >
    <!--菜单回显-->
    <#assign currentMenu="customerTraceHistory"/>
    <#include "../common/menu.ftl" >
    <div class="content-wrapper">
        <section class="content-header">
            <h1>跟进历史管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <form class="form-inline" id="searchForm" action="/customerTraceHistory/list.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="keyword">关键字:</label>
                            <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}"
                                   placeholder="请输入姓名">
                        </div>
                        <div class="form-group">
                            <label for="type"> 跟进类型:</label>
                            <select class="form-control" id="type" name="type">
                                <option value="-1">全部</option>
                                <option value="0">潜在用户</option>
                                <option value="1">正式用户</option>
                            </select>
                            <script>
                                $("#type option[value='${qo.type!}']").prop("selected", true);
                            </script>
                        </div>
                        <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span>
                            查询
                        </button>
                    </form>
                </div>
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>姓名</th>
                        <th>跟进日期</th>
                        <th>跟进内容</th>
                        <th>跟进方式</th>
                        <th>跟进结果</th>
                        <th>录入人</th>
                        <th>跟进类型</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <#list result.list as entity>
                        <tr>
                            <td>${entity_index+1}</td>
                            <td>${(entity.customer.name)!}</td>
                            <td>${(entity.traceTime)?string("yyyy-MM-dd")}</td>
                            <td>${(entity.traceDetails)!}</td>
                            <td>${(entity.traceType.title)!}</td>
                            <td>${(entity.resultName)!}</td>
                            <td>${(entity.inputUser.name)!}</td>
                            <td>${(entity.typeName)!}</td>
                            <td>
                                <a class="btn btn-info btn-xs inputBtn" data-json='${entity.json}' >
                                    <span class="glyphicon glyphicon-pencil"></span>编辑
                                </a>
                            </td>
                        </tr>
                    </#list>
                </table>
                <!--分页-->
                <#include "../common/page.ftl" >
        </section>
    </div>
            <#include "../common/footer.ftl" >
</div>
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title inputTitle">记录编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customerTraceHistory/saveOrUpdate.do" method="post" id="editForm">
                    <input type="hidden" name="id">
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">客户名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="customer.name" readonly
                            />
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">跟进时间：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="traceTime"
                            />
                        </div>
                    </div>
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">跟进内容：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="traceDetails" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">跟进方式：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="traceType.id">
                            <#list traceTypes as t>
                                <option value="${t.id}">${t.title}</option>
                            </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">跟进结果：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="traceResult">
                                <option value="1">差</option>
                                <option value="2">中</option>
                                <option value="3">优</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">备注：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="remark"
                            />
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">跟进类型：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="type">
                                <option value="0">潜在用户跟进</option>
                                <option value="1">正式用户跟进</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary inputSubmit" >保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>


</body>
</html>
